<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>添加常见问题</title>
    <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
    <script type="text/javascript">
    $(function(){
        $("#form").submit(function(){
          if($("[name='classes.id']").val()==0){
             alert("请选择分类");
             return false;
          }
           if($("[name='title']").val().length==0){
             alert("请填写标题");
             return false;
            }
           if($("[name='content']").val().length==0){
             alert("请填写内容");
             return false;
          }
          return true;
           
        });
    });
    
    </script>
  </head>
  
  <body>
     <form action="faqs_add.action" method="post" id="form" >
     <h1 align="center">添加常见问题</h1>
     <table align="center">
         <tr>
           <td>分类：</td>
           <td><s:select list="clist" name="classes.id" listKey="id" listValue="cname"  headerKey="0" headerValue="请选择"/></td>
         </tr>
         <tr>
           <td>标题：</td>
           <td><input type="text" name="title"></td>
         </tr>
         <tr>
           <td>内容：</td>
           <td><s:textarea name="content"/></td>
         </tr>
           <tr>
           <td colspan="2" ><input type="submit" value="保存"><input type="reset" value="重置"><input type="button" value="取消" onclick="window.location.href='faqs_list.action'"></td>
         </tr>
     </table>
     </form>
  </body>
</html>
